Skip to content

Conversation

@teunbrand
Copy link
Collaborator

This PR aims to fix #6533.

Briefly, line geoms require special NA-handling methods because we want to exclude terminal vertices but not internal vertices from a path. We use group to determine these, but we should consider PANEL as well.

Reprex from issue:

devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2

d2 <- data.frame(x = 1:3, col = c("blue", "green", NA)) |> 
  tidyr::crossing(group = c("A", "B"))

ggplot(d2, aes(x, x, color = I(col), group = 1)) +
  facet_wrap(~ group) + 
  geom_line(lwd = 2)
#> Warning: Removed 2 rows containing missing values or values outside the scale range
#> (`geom_line()`).

Created on 2025-07-03 with reprex v2.1.1

@teunbrand teunbrand added this to the ggplot2 4.0.1 milestone Oct 7, 2025
Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@teunbrand teunbrand merged commit c0a6923 into tidyverse:main Oct 20, 2025
13 checks passed
@teunbrand teunbrand deleted the fix_6533 branch October 20, 2025 12:37
@teunbrand teunbrand mentioned this pull request Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected behaviour of colors in geom_line()

2 participants